import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EquipmentInfoVO, EquipmentInfoForm, EquipmentInfoQuery } from '@/api/facility/equipment-info/types';

/**
 * 查询设备信息列表
 * @param query
 * @returns {*}
 */

export const listEquipmentInfo = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/equipment/equipment-info/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备信息详细
 * @param equipmentId
 */
export const getEquipmentInfo = (equipmentId: string | number): AxiosPromise<EquipmentInfoVO> => {
  return request({
    url: '/equipment/equipment-info/' + equipmentId,
    method: 'get'
  });
};

/**
 * 新增设备信息
 * @param data
 */
export const addEquipmentInfo = (data: EquipmentInfoForm) => {
  return request({
    url: '/equipment/equipment-info',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备信息
 * @param data
 */
export const updateEquipmentInfo = (data: EquipmentInfoForm) => {
  return request({
    url: '/equipment/equipment-info',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备信息
 * @param equipmentId
 */
export const delEquipmentInfo = (equipmentId: string | number | Array<string | number>) => {
  return request({
    url: '/equipment/equipment-info/' + equipmentId,
    method: 'delete'
  });
};

/**
 * 顶部统计
 */
export const equipmentstatisticstatus = () => {
  return request({
    url: '/equipment/equipment-info/selectStatisticStatusResult',
    method: 'get'
  });
};

/**
 * 顶部统计
 */
export const equipmentstatistic = () => {
  return request({
    url: '/equipment/equipment-info/selectStatisticResult/all',
    method: 'get'
  });
};
